package org.bonorsoft.modules.control.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.bonorsoft.modules.control.entity.Hazard;
import org.bonorsoft.modules.control.entity.InfoTemplate;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

/**
 * @Description: 信息模板对应逻辑
 * @Author: WilliamYe
 * @Date:   2021-02-07
 * @Version: V1.0
 */
public interface InfoTemplateMapper extends BaseMapper<InfoTemplate> {

    @Select("select " +
                "h.hazard_id, h.hazard_name " +
            "from " +
                "police_hazard h " +
                "left join police_info_template p " +
                "on p.hazard_id like concat('%',concat(h.hazard_id,'%')) " +
            "where " +
                "p.info_id = #{code}")
    List<Hazard> getHazardNameByCode(String code);
}
